package org.hiberlyzer;

import java.io.PrintWriter;
import java.io.StringWriter;

public class QueryException extends Exception
{
	public QueryException(String queryString, Throwable cause)
	{
		super("Unable to execute query: \"" + queryString + "\"", cause);
	}

	@Override
	public String getMessage()
	{
		StringWriter sw = new StringWriter();
		PrintWriter pw = new PrintWriter(sw);
		getCause().printStackTrace(pw);
		pw.close();
		return super.getMessage() + "\n" + sw.toString();
	}
}